<template>
  <div v-if="files&&files.length" class="file-list-wrapper">
    <ul class="el-upload-list el-upload-list--text">
      <li v-for="(f,index) in files" :key="index" tabindex="0" class="el-upload-list__item is-success">
        <a class="el-upload-list__item-name" target="_blank" @click="downloadExport(f)">
          <i class="el-icon-document" />{{ f.name }}
        </a>
        <label class="el-upload-list__item-status-label">
          <i class="el-icon-upload-success el-icon-circle-check" />
        </label>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "FileList",
  props: {
    files: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    downloadExport(file){
      console.log(file,'8888')
      var url =file.url
      console.log(this.formKey,this.formName,'啊啊啊')
      console.log(url,'url')
      const elink = document.createElement('a')
      elink.style.display = 'none'
      elink.href = url
      elink.download=file.name
      document.body.appendChild(elink)
      elink.click()
      document.body.removeChild(elink)
    }
  }
}
</script>

<style lang="scss" scoped>
.file-list-wrapper{
  width: 95%;
}
</style>
